<!DOCTYPE html>
<!-- saved from url=(0030)http://124.223.42.90:5000/ssq/ -->
<html lang="zh"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <title>双色球号码生成器</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            margin-top: 50px;
        }
        .container {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            margin-top: 20px;
        }
        .module {
            flex: 1;
            margin: 10px;
            border: 1px solid #ddd;
            padding: 20px;
            border-radius: 8px;
        }
        .module-large {
            flex: 2;
        }
        .number-set {
            display: flex;
            align-items: center;
            justify-content: center;
            margin-top: 10px;
        }
        .ball {
            display: inline-block;
            width: 40px;
            height: 40px;
            line-height: 40px;
            border-radius: 50%;
            margin: 5px;
            font-weight: bold;
            text-align: center;
        }
        .ball.front {
            background-color: #d9534f; /* 红色 */
            color: #fff; /* 白色字体 */
        }
        .ball.back {
            background-color: #5bc0de; /* 蓝色 */
            color: #fff; /* 白色字体 */
        }
        .input-set input {
            width: 40px;
            height: 40px;
            text-align: center;
            margin: 5px;
            border: none;
            font-size: 16px;
            border-radius: 50%;
        }
        .input-set input.front {
            background-color: #f2dede; /* 浅红色 */
            color: #fff; /* 白色字体 */
        }
        .input-set input.back {
            background-color: #d9edf7; /* 浅蓝色 */
            color: #fff; /* 白色字体 */
        }
        input[type=number]::-webkit-outer-spin-button,
        input[type=number]::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
        input[type=number] {
            -moz-appearance: textfield;
        }
        button {
            margin-top: 10px;
            padding: 10px 20px;
            border: none;
            background-color: #5bc0de;
            color: white;
            font-size: 16px;
            cursor: pointer;
            border-radius: 4px;
        }
        button:hover {
            background-color: #46b8da;
        }
        .copy-button {
            margin-left: 10px;
            padding: 5px 10px;
            background-color: #5bc0de;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .probability {
            margin-left: 20px;
            font-size: 14px;
            color: #333;
        }
    </style>
</head>
<body>
    <input type="text" id="hidden-input" style="position: absolute; left: -9999px;">
    <h1>双色球号码生成器</h1>
    <div class="container">
        <div class="module module-large">
            <h2>生成号码</h2>
            <button onclick="generateNumbers()">生成号码</button>
            <button onclick="copyAllNumbers(&#39;numbers&#39;)">复制全部号码</button>
            <div id="numbers"><div class="number-set"><span class="ball front">2</span><span class="ball front">6</span><span class="ball front">11</span><span class="ball front">16</span><span class="ball front">20</span><span class="ball front">25</span><span class="ball back">13</span><span class="probability">幸运度: 100.00%</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">6</span><span class="ball front">12</span><span class="ball front">18</span><span class="ball front">26</span><span class="ball front">30</span><span class="ball front">33</span><span class="ball back">9</span><span class="probability">幸运度: 92.81%</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">6</span><span class="ball front">12</span><span class="ball front">18</span><span class="ball front">25</span><span class="ball front">29</span><span class="ball front">33</span><span class="ball back">10</span><span class="probability">幸运度: 80.52%</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">6</span><span class="ball front">12</span><span class="ball front">18</span><span class="ball front">25</span><span class="ball front">29</span><span class="ball front">33</span><span class="ball back">11</span><span class="probability">幸运度: 72.81%</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">6</span><span class="ball front">12</span><span class="ball front">18</span><span class="ball front">24</span><span class="ball front">29</span><span class="ball front">33</span><span class="ball back">11</span><span class="probability">幸运度: 65.64%</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">5</span><span class="ball front">11</span><span class="ball front">17</span><span class="ball front">23</span><span class="ball front">28</span><span class="ball front">33</span><span class="ball back">15</span><span class="probability">幸运度: 48.40%</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">6</span><span class="ball front">11</span><span class="ball front">18</span><span class="ball front">24</span><span class="ball front">29</span><span class="ball front">33</span><span class="ball back">11</span><span class="probability">幸运度: 45.64%</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">6</span><span class="ball front">11</span><span class="ball front">18</span><span class="ball front">24</span><span class="ball front">29</span><span class="ball front">33</span><span class="ball back">12</span><span class="probability">幸运度: 41.27%</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">4</span><span class="ball front">10</span><span class="ball front">15</span><span class="ball front">21</span><span class="ball front">26</span><span class="ball front">30</span><span class="ball back">16</span><span class="probability">幸运度: 36.79%</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">5</span><span class="ball front">10</span><span class="ball front">16</span><span class="ball front">21</span><span class="ball front">26</span><span class="ball front">30</span><span class="ball back">15</span><span class="probability">幸运度: 34.36%</span><button class="copy-button">复制</button></div></div>
        </div>
        <div class="module">
            <h2>随机生成的号码</h2>
            <button onclick="generateRandomNumbers()">生成随机号码</button>
            <button onclick="copyAllNumbers(&#39;random-numbers&#39;)">复制全部号码</button>
            <div id="random-numbers"><div class="number-set"><span class="ball front">7</span><span class="ball front">14</span><span class="ball front">18</span><span class="ball front">27</span><span class="ball front">30</span><span class="ball front">33</span><span class="ball back">14</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">11</span><span class="ball front">19</span><span class="ball front">22</span><span class="ball front">23</span><span class="ball front">25</span><span class="ball front">31</span><span class="ball back">4</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">3</span><span class="ball front">5</span><span class="ball front">10</span><span class="ball front">15</span><span class="ball front">19</span><span class="ball front">27</span><span class="ball back">9</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">1</span><span class="ball front">3</span><span class="ball front">10</span><span class="ball front">19</span><span class="ball front">22</span><span class="ball front">29</span><span class="ball back">9</span><button class="copy-button">复制</button></div><div class="number-set"><span class="ball front">2</span><span class="ball front">9</span><span class="ball front">13</span><span class="ball front">18</span><span class="ball front">24</span><span class="ball front">33</span><span class="ball back">2</span><button class="copy-button">复制</button></div></div>
            <!-- <h2>输入你的号码</h2>
      
           <div class="input-set">
                <input type="number" class="front" id="input1" min="1" max="33" oninput="moveToNext(this, &#39;input2&#39;)">
                <input type="number" class="front" id="input2" min="1" max="33" oninput="moveToNext(this, &#39;input3&#39;)">
                <input type="number" class="front" id="input3" min="1" max="33" oninput="moveToNext(this, &#39;input4&#39;)">
                <input type="number" class="front" id="input4" min="1" max="33" oninput="moveToNext(this, &#39;input5&#39;)">
                <input type="number" class="front" id="input5" min="1" max="33" oninput="moveToNext(this, &#39;input6&#39;)">
                <input type="number" class="front" id="input6" min="1" max="33" oninput="moveToNext(this, &#39;input7&#39;)">
                <input type="number" class="back" id="input7" min="1" max="16">
            </div>
            <button onclick="scoreNumbers()">提交号码</button> -->
            <div id="score"></div>
        </div>
    </div>

    <script>
        function moveToNext(current, nextFieldID) {
            if (current.value.length >= current.max.length) {
                document.getElementById(nextFieldID).focus();
            }
        }

        function generateNumbers() {
            const numbersDiv = document.getElementById('numbers');
            numbersDiv.innerHTML = '';  // 清空现有号码
            for (let i = 0; i < 10; i++) {
                const numberSet = generateUniqueNumbers();
                const numberSetDiv = document.createElement('div');
                numberSetDiv.classList.add('number-set');

                numberSet.forEach((num, idx) => {
                    const ball = document.createElement('span');
                    ball.classList.add('ball');
                    ball.textContent = num;
                    if (idx < 6) {
                        ball.classList.add('front');
                    } else {
                        ball.classList.add('back');
                    }
                    numberSetDiv.appendChild(ball);
                });

                // 显示判别器计算的概率
                const probText = document.createElement('span');
                probText.className = 'probability';
                probText.textContent = `幸运度: ${(Math.random() * 100).toFixed(2)}%`; // 随机概率
                numberSetDiv.appendChild(probText);

                // 添加复制按钮
                const copyButton = document.createElement('button');
                copyButton.classList.add('copy-button');
                copyButton.textContent = '复制';
                copyButton.onclick = () => copyNumbers(numberSet);
                numberSetDiv.appendChild(copyButton);

                numbersDiv.appendChild(numberSetDiv);
            }
        }

        function generateRandomNumbers() {
            const randomNumbersDiv = document.getElementById('random-numbers');
            randomNumbersDiv.innerHTML = '';  // 清空现有号码
            for (let i = 0; i < 5; i++) {
                const numberSet = generateUniqueNumbers();
                const numberSetDiv = document.createElement('div');
                numberSetDiv.classList.add('number-set');

                numberSet.forEach((num, idx) => {
                    const ball = document.createElement('span');
                    ball.classList.add('ball');
                    ball.textContent = num;
                    if (idx < 6) {
                        ball.classList.add('front');
                    } else {
                        ball.classList.add('back');
                    }
                    numberSetDiv.appendChild(ball);
                });

                // 添加复制按钮
                const copyButton = document.createElement('button');
                copyButton.classList.add('copy-button');
                copyButton.textContent = '复制';
                copyButton.onclick = () => copyNumbers(numberSet);
                numberSetDiv.appendChild(copyButton);

                randomNumbersDiv.appendChild(numberSetDiv);
            }
        }

        function generateUniqueNumbers() {
            const frontNumbers = Array.from({ length: 33 }, (_, i) => i + 1);
            const backNumbers = Array.from({ length: 16 }, (_, i) => i + 1);

            const selectedFrontNumbers = [];
            const selectedBackNumbers = [];

            while (selectedFrontNumbers.length < 6) {
                const randomIndex = Math.floor(Math.random() * frontNumbers.length);
                selectedFrontNumbers.push(frontNumbers[randomIndex]);
                frontNumbers.splice(randomIndex, 1);
            }

            while (selectedBackNumbers.length < 1) {
                const randomIndex = Math.floor(Math.random() * backNumbers.length);
                selectedBackNumbers.push(backNumbers[randomIndex]);
                backNumbers.splice(randomIndex, 1);
            }

            return [...selectedFrontNumbers, ...selectedBackNumbers];
        }

        function copyNumbers(numbers) {
            const text = numbers.join(' ');
            const hiddenInput = document.getElementById('hidden-input');
            hiddenInput.value = text;
            hiddenInput.select();
            try {
                document.execCommand('copy');
                alert('号码已复制: ' + text);
            } catch (err) {
                console.error('无法复制号码', err);
            }
        }
        
        function copyAllNumbers(containerId) {
            const container = document.getElementById(containerId);
            const text = Array.from(container.querySelectorAll('.number-set')).map(set => {
                return Array.from(set.querySelectorAll('.ball')).map(ball => ball.textContent).join(' ');
            }).join('\n');
            const hiddenInput = document.getElementById('hidden-input');
            hiddenInput.value = text;
            hiddenInput.select();
            try {
                document.execCommand('copy');
                alert('全部号码已复制');
            } catch (err) {
                console.error('无法复制号码', err);
            }
        }

        function scoreNumbers() {
            const numbers = [
                parseInt(document.getElementById('input1').value),
                parseInt(document.getElementById('input2').value),
                parseInt(document.getElementById('input3').value),
                parseInt(document.getElementById('input4').value),
                parseInt(document.getElementById('input5').value),
                parseInt(document.getElementById('input6').value),
                parseInt(document.getElementById('input7').value)
            ];

            fetch('/ssq/score', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify({ numbers: numbers })
            })
            .then(response => response.json())
            .then(data => {
                const scoreDiv = document.getElementById('score');
                if (data.score !== undefined) {
                    scoreDiv.textContent = `你的号码的幸运度: ${(data.score * 100).toFixed(2)}%`;
                } else {
                    scoreDiv.textContent = '无法获取数据或数据格式错误';
                }
            })
            .catch(error => {
                console.error('Error:', error);
                const scoreDiv = document.getElementById('score');
                scoreDiv.textContent = '请求过程中出错';
            });
        }

        document.addEventListener('DOMContentLoaded', generateNumbers);
        document.addEventListener('DOMContentLoaded', generateRandomNumbers);
    </script>


</body></html>